<include file="Public:html" />

<link type="text/css" rel="stylesheet" media="screen" href="../Public/css/member.css" />
<script type="text/javascript">
	$(document).ready(function(){
	    $.formValidator.initConfig({
	        formid:"order_addr",
	        validatorgroup:"order_addr_check",
	        autotip:true
	    });
	
	    $("#userRealName").formValidator({
	        validatorgroup:"order_addr_check",
	        empty:false,
	        tipid:'notetip',
	        onshow:"请输入接收人的名字",
	        onfocus:"请输入接收人的名字",
	        oncorrect:" "
	    }).inputValidator({
	        min:1,onerror:"接收人不能为空,请确认"
	    });
	
	    $("#userPhoneNumber").formValidator({
	        validatorgroup:"order_addr_check",
	        empty:false,
	        tipid:'notetip',
	        onshow:"请输入手机号",
	        onfocus:"请输入手机号",
	        oncorrect:" "
	    }).inputValidator({
	        min:1,onerror:"手机不能为空,请确认"
	    });
	
	    $("#detailedAddress").formValidator({
	        validatorgroup:"order_addr_check",
	        empty:false,
	        tipid:'notetip',
	        onshow:"请输入收货人地址",
	        onfocus:"请输入收货人地址",
	        oncorrect:" "
	    }).inputValidator({
	        min:1,onerror:"收货人不能为空,请确认"
	    });
	
	    $("#remarks").formValidator({
	        validatorgroup:"order_addr_check",
	        empty:false,
	        tipid:'notetip',
	        onshow:"如果您有什么补充，请备注说明",
	        onfocus:"如果您有什么补充，请备注说明",
	        oncorrect:" "
	    });
	
	    $("#zipCode").formValidator({
	        validatorgroup:"order_addr_check",
	        empty:false,
	        tipid:'notetip',
	        onshow:"请输入邮政编码",
	        onfocus:"请输入邮政编码",
	        oncorrect:" "
	    }).inputValidator({
	        min:1,onerror:"邮政编码不能为空,请确认"
	    });
	
	    $("#ordernext").click(function(){
	        //alert('aaaaaaaaa');
	        var pass=$.formValidator.pageIsValid('order_addr_check');
	        //var flag = $('#flag').attr('value');
	        
	        //if(pass && (flag!='0')){
	        if(pass){
	            //$('#order_addr').trigger("submit");
	            $byid('order_addr').submit();
	        }
	    });
	    $("#lneedinvoice").change(function(){
	        var val = this.value;
	        var saleprice = $("#osaleprice").text();
	        var servicefee = $("#oservicefee").text();
	        var fee = $("#ofee").text();
	        if(val=='2'){
	            $("#oinvoicefee").text("20");
	        }else{
	            $("#oinvoicefee").text("0");
	        }
	        var invoicefee = $("#oinvoicefee").text();
	        var orderprice = parseFloat(saleprice) + parseFloat(servicefee)+parseFloat(fee)+parseFloat(invoicefee);
	        $("#oorderprice").text(orderprice.toString());
	    });
	
	});
	
	function checkRealname(){
	    var a = $('#realname').attr('value');
	    var b = $('#userRealName').attr('value');
	    var c = $('#flag').attr('value');
	    if(a==''||a==null){
	        alert('请输入收货人信息!');
	        return;
	    }
	    if((a!=b)||(c=='0')){
	        if(confirm('收货人姓名必须是您的真实姓名！是否以"'+b+'"作为您的真实姓名?\n注意:为了您的帐户安全，确认收货人后，此收货人即为您帐户的唯一指定收货人，不可更改!')){
	            $.post(APP+"/Member/setRealname",
	                   {realname:b},
	                   function(data){
	                       if(data==1){
	                           $('#realname').attr('value',b);
	                           $('#flag').attr('value',1);
	                       }
	                   });
	        }
	    }
	}

</script>

</head>


<body id="paiban" class="skin">


<form action="__APP__/Member/saveOrder/" method="post" id="order_addr" name="order_addr">

	<input type="hidden" name="id" id="id" value="{$orderdata.id}" />

<div id="contentWrap" class="clearfix regWrap cb" style="float:none; margin:0 auto;">

    <fieldset id="orderInfo">
        <legend>未支付订单 (编号:{$orderdata.ordersn})</legend>
        <table>
            <tr>
                <th width="45%">商品</th>
                <th width="18%">成交时间</th>
                <th width="18%">保留时间</th>
                <th width="19%">成交价</th>
            </tr>
            <tr>
                <td>
                    <a target="_blank" href="{:U('/Auction/detail/id/'.$orderdata['aid'])}" title="{$orderdata.goodsname}"><img  alt="{$orderdata.goodsname}" src="__PUBLIC__/accessory/img/{$orderdata.thumbnail}" /></a>
                    <a target="_blank" class="displayBlock" href="{:U('/Auction/detail/id/'.$orderdata['aid'])}" title="{$orderdata.goodsname}">{$orderdata.goodsname}{$orderdata.sn}</a>
                </td>
                <td class="f10">{$orderdata.addtime|date='Y-m-d H:i:s',###}</td>
                <td class="f10">{$orderdata.ordertime|date='Y-m-d H:i:s',###}</td>

                <td><strong class="price">&yen;
                        <span id="osaleprice">
                            <eq name="orderdata['type']" value="0">{$orderdata.goodsprice}</eq>
                            <eq name="orderdata['type']" value="1">{$orderdata.realprice}</eq>
                        </span>
                    </strong>
                </td>
            </tr>
         <eq name="orderdata['type']" value="0">
            <tr class="freightList">
                <td colspan="3" class="tr">补差价：</td>
                <td><strong class="price">
                - &yen;<span id="oservicefee">{$orderdata.premium}</span>
                </strong></td>

            </tr>
            
            <tr class="freightList">
                <td colspan="3" class="tr">运费：</td>
                <td><strong class="price">
                + &yen;<span id="ofee">{$orderdata.goodsfreight}</span>
                </strong></td>
            </tr>
         </eq>
            <tr>
                <td colspan="3" class="tr">您需要为订单支付：</td>

                <td><strong class="keyword f16">&yen;<span id="oorderprice">{$orderdata.orderprice}</span></strong></td>
            </tr>
        </table>
    </fieldset>
    
    

    <fieldset>
        <legend>收件人详情 <a href="javascript:userAddress();" onFocus="this.blur();">[我的地址薄]</a></legend>

        <div class="userAddress clearfix fl">
			<div class="inputWrap fl">
	                <label>收货人:</label>
	                <input id="userRealName" name="userRealName" type="text" class="input" style="width:74px;" value="{$orderdata.recipient}"/>
	      </div>
            <div class="inputWrap fl">
                <label>手机或电话:</label>

                <input id="userPhoneNumber" name="userPhoneNumber" type="text" class="input" style="width:100px;" value="{$orderdata.tel}" />
            </div>
            <div class="inputWrap fl">
                <label>邮编:</label>
                <input id="zipCode" name="zipCode" type="text" class="input notice" value="{$orderdata.postalcode}" style=" width:50px;" title="邮编" />
            </div>
            <div class="cb"></div>
            <div class="inputWrap fl cl">
                <label>收货地址:</label>
                <textarea id="detailedAddress" name="detailedAddress" class="input textarea" style="width:191px; height:50px;"  title="详细街道门牌">{$orderdata.address}</textarea>
            </div>
            <div class="inputWrap fl">
                <label>备注:</label>
                <textarea id="remarks" name="remarks" class="input textarea notice" style="width:220px; height:50px;" title="如果您有什么补充，请在备注说明">{$orderdata.remark}</textarea>
            </div>
        </div>
    </fieldset>

    <div id="notetip" class="clearfix"></div>

</div>


</form>


<div id="orderSubmitButton" class="cb">
    <span class="button button-hilite">
        <span class="first-child">
            <button id="ordernext">下一步，核对订单信息</button>
        </span>
    </span>
</div>


</body>
</html>